remotemanager.transport.rsync module

Handles file transfer via the rsync protocol

class remotemanager.transport.rsync.rsync(*args, **kwargs)[source]

Class for rsync protocol

Parameters:
  • checksum (bool) – Adds checksum arg, which if True will add --checksum flag to parameters

  • progress (bool) – request streaming of rsync –progress stdout

check_version(collect_only: bool = False, min_version: str = None) Version[source]

Queries the installed rsync version and checks that it is recent enough

Does nothing if the version could not be detected, so should be considered a “soft” check, rather than a true safety feature.

Parameters:
  • collect_only (bool) – Does not perform a check if True. Defaults to False

  • min_version (str) – override the minimum version (used for testing)

Returns:

Version

cmd(primary, secondary)[source]

Returns a formatted command for issuing transfers. It is left to the developer to implement this method when adding more transport classes.

The implementation should take two strings as arguments, primary and secondary:

Parameters:
  • primary (str) –

    The source folder, containing the files for transfer. Input will be semi-formatted already in bash form.

    e.g. directory_name/{file1,file2,file3,…,fileN}

  • secondary (str) – The destination folder for the files

At its most basic:

``` def cmd(self, primary, secondary):

cmd = “command {primary} {secondary}” base = cmd.format(primary=primary, secondary=secondary) return base

```

You can, of course, extend upon this. View the included transport methods for ideas on how to do this.

Returns (str):

formatted command for issuing a transfer